facebook_init(appKey)
N/A
Before using any of the Facebook functions you must call this function to initialize the Facebook API and tell GameMaker Studio 2 that you are going to be using the Facebook specific functions. This should be done only once in the game and can be done at any time, but it is recommended that you call this function right at the start before anything else. Note too, that even if you use facebook_logout at some point in your game you will not need to use this function again to log in.
facebook_init();
var permissions = ds_list_create();
ds_list_add(permissions,"public_profile", "user_friends");
facebook_login(permissions);
ds_list_destroy(permissions);
The above code initialises Facebook, then creates a ds_list to hold the specific permissions that you wish to request, and finally logs in using these permissions.